<template>
	<view>
		<search-head :historyItem="historyItem"></search-head>
		<!-- 下方 -->
		<view class="history" v-if="numberHistory">
			<view>历史搜索</view>
			<!-- 搜索记录 -->
			<view class="history_item">
				<view class="item" v-for="(item,index) in numberHistory" :key="index" @click="toHistory(item)">{{item}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import searchHead from '../../components/search-head/search-head.vue'
	export default {
		components:{
			searchHead
		},
		data() {
			return {
				numberHistory:"",
				historyItem:""
			}
		},
		methods: {
			toHistory(item){
				this.historyItem=item
			}
			
		},
		onShow() {
			this.numberHistory=uni.getStorageSync("history")
		}
	}
</script>

<style scoped>
.history{
	padding: 30rpx;
}
.history_item{
	display: flex;
	margin-top: 20rpx;
}
.item{
	margin-right: 20rpx;
	background-color: #f5f5f5;
	font-size: 25rpx;
	padding: 5rpx 20rpx;
	color: rgba(0, 0, 0, 0.6);
}
</style>
